import React from 'react';

class BoxTitle extends React.Component {
	constructor(props) {
	  super(props);
	  this.state={
	  	flag:1
	  };
	}

	changeFlag(flag,e) {
		this.setState({flag:flag===0?1:0});
	}

	render() {
		return (
			<div className="mn">
				<div className="bm fl">
					<div className="bm bmw bmborders flg cl">
						<div className="bm_h cl">
							<span className="o">
								<img onClick={this.changeFlag.bind(this,this.state.flag)} src={this.state.flag?"http://img.htmlsucai.com/huyoucss/collapsed_yes.gif":"http://img.htmlsucai.com/huyoucss/collapsed_no.gif"} title="收起/展开" alt="收起/展开" />
							</span>
							<h2><a href="#" onClick={this.changeFlag.bind(this,this.state.flag)}>{this.props.title}</a></h2>
						</div>
						<div className="bm_c">
							{this.state.flag?this.props.children:""}
						</div>
					</div>
				</div>
			</div>
		);
	}
}

export default BoxTitle